/* ChatPage.css */
/* ========== 基础样式 ========== */
.chat-interface {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f5f5f5;
}

/* ========== 头部区域 ========== */
.chat-interface__header {
  background-color: #3d50ff;
  color: var(--text-color-white);
  padding: 16px;
  text-align: left;
  display: flex;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
}

.header-logo {
  background-color: white;
  color: #3d50ff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 8px;
}

.header-text {
  color: white;
}

/* ========== 消息区域 ========== */
.chat-interface__messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: #f5f5f5;
}

.chat-message {
  display: flex;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(10px);
  animation: messageAppear 0.3s ease-out forwards;
}

.chat-message--user {
  flex-direction: row-reverse;
  margin-left: auto;
  animation-delay: 0.1s;
}

.chat-message--ai {
  margin-right: auto;
  animation-delay: 0.2s;
}

.ai-avatar {
  width: 40px;
  height: 40px;
  background-color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 12px;
}

.ai-avatar-text {
  color: #3d50ff;
  font-weight: bold;
}

.chat-message__bubble {
  max-width: 70%;
  margin-bottom: 4px;
}

.chat-message__content {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  word-break: break-word;
  background-color: #ffffff;
}

.chat-message__content--user {
  background-color: var(--primary-color);
  color: var(--text-color-white);
  border-bottom-right-radius: 4px;
}

.chat-message__content--ai {
  background-color: #ffffff;
  color: var(--text-color-primary);
  border-bottom-left-radius: 4px;
}

.chat-message__timestamp {
  font-size: 12px;
  color: var(--text-color-secondary);
  margin-bottom: 4px;
  text-align: left;
}

.chat-message--user .chat-message__timestamp {
  text-align: right;
}

/* ========== 输入区域 ========== */
.chat-interface__input-area {
  display: flex;
  padding: 16px;
  border-top: 1px solid var(--border-color-light);
  background-color: #ffffff;
}

.chat-interface__input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border-color-base);
  border-radius: 6px;
  margin-right: 12px;
  font-size: 14px;
}

.chat-interface__input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.chat-interface__send-button {
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: var(--text-color-white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.chat-interface__send-button:hover {
  background-color: var(--primary-color-hover);
}

.chat-interface__send-button:disabled {
  background-color: var(--disabled-color);
  cursor: not-allowed;
}

/* ========== 错误提示 ========== */
.chat-interface__error {
  padding: 12px;
  background-color: var(--error-background);
  color: var(--error-color);
  text-align: center;
  border-top: 1px solid var(--error-border);
}

/* ========== 打字动画 ========== */
.chat-message__typing {
  display: flex;
  padding: 12px;
}

.chat-message__typing-dot {
  height: 8px;
  width: 8px;
  background-color: var(--text-color-secondary);
  border-radius: 50%;
  margin: 0 4px;
  animation: bounce 1.5s infinite ease-in-out;
}

.chat-message__typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-message__typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ========== 动画定义 ========== */
@keyframes messageAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .chat-message__bubble {
    max-width: 80%;
  }
}

/* ========== CSS变量定义 ========== */
:root {
  --primary-color: #1890ff;
  --primary-color-hover: #40a9ff;
  --text-color-white: #ffffff;
  --text-color-primary: #333333;
  --text-color-secondary: #8c8c8c;
  --background-color-white: #ffffff;
  --background-color-light: #fafafa;
  --background-color-gray: #f0f0f0;
  --border-color-base: #d9d9d9;
  --border-color-light: #e0e0e0;
  --disabled-color: #d9d9d9;
  --error-color: #ff4d4f;
  --error-background: #fff2f0;
  --error-border: #ffccc7;
}

/* ========== 自动回复消息样式 ========== */
.auto-reply-message {
  background-color: #fff;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.auto-reply-message h4 {
  color: #3d50ff;
  margin: 16px 0 8px 0;
}

.auto-reply-message ul {
  padding-left: 24px;
  margin: 12px 0;
}

.auto-reply-message li {
  margin-bottom: 8px;
}

.auto-reply-message a {
  color: #3d50ff;
  text-decoration: none;
  transition: color 0.2s;
}

.auto-reply-message a:hover {
  color: #2a3acc;
  text-decoration: underline;
}

/* ========== 帮助中心按钮样式 ========== */
.help-center-button {
  background-color: #3d50ff;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: inline-block;
}

.help-center-button:hover {
  background-color: #2a3acc;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.help-center-button:active {
  transform: translateY(0);
}

/* ========== 教程链接样式 ========== */
.tutorial-links {
  margin: 12px 0;
}

.tutorial-links ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px 16px;
  padding-left: 16px;
}

.tutorial-links li {
  margin-bottom: 6px;
  list-style-type: disc;
}

.tutorial-links a {
  color: #3d50ff;
  text-decoration: none;
  transition: color 0.2s;
}

.tutorial-links a:hover {
  color: #2a3acc;
  text-decoration: underline;
}